const express = require('express')
const app = express()
const bodyParser = require('body-parser')

app.get('/', (req, res) => res.send('Hello World!'))

app.use(bodyParser.json({limit: '1mb'}));  //body-parser 解析json格式数据
app.use(bodyParser.urlencoded({            //此项必须在 bodyParser.json 下面,为参数编码
  extended: true
}));

var json  = {
    name: 'zhang',
    age:25
}


app.get('/api/test', (req, res) => res.send(json))

app.post('/api/post/test', (req, res) =>{
    let arr = []
    for(let i = 0; i<100; i++){
        arr.push(i)
    }
    res.send(arr)
})
app.listen(3000, () => console.log('Example app listening on port 3000!'))